<!-- 审核通过 -->
<template>
	<view class="content">
		<view class="contents">
			<view class="firstBox">
				<view class="item">
					<view>{{info.produceValidIncome}}</view>
					<text>可提现金额（元）</text>
					<view class="btnBox" @click='withdrawal'>提现</view>
					<image src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/mine/create/_img2.png"></image>
				</view>
				<view class="item">
					<view>{{info.produceTotalIncome}}</view>
					<text>累计收益（元）</text>
					<view class="btnBox" @click="$emit('detail')">收益明细</view>
					<image src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/mine/create/_img3.png"></image>
				</view>
			</view>
			<view class="secondBox">
				<text>本月收入情况</text>
				<view class="item border_bottom">
					<view class="box1">
						<image src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/mine/create/_img4.png"></image>
						<text>收入金额（元）</text>
					</view>
					<text>{{Number(info.thisMonthIncome)}}</text>
				</view>
				<view class="item item2">
					<view class="box1">
						<image src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/mine/create/_img5.png"></image>
						<text>收入笔数</text>
					</view>
					<text>{{Number(info.thisMonthOrderNum)}}笔</text>
				</view>
			</view>
			<view class="thirdBox">
				<view class="item border_bottom" @click='record'>
					<view class="left">
						<text>提现记录</text>
						<view>每一笔提现都在这里~</view>
					</view>
					<image src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/mine/create/_img1.png"></image>
				</view>
				<view class="item" @click="$emit('goMyUpload')">
					<view class="left">
						<text>我的课程</text>
						<view>我上传的所有课程</view>
					</view>
					<image src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/mine/create/_img1.png"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getEarnings
	} from '@/apis/apis.js'
	export default {
		data() {
			return {
				info: {}
			}
		},
		mounted() {
			this.init()
		},
		methods: {
			init() {
				getEarnings().then(res => {
					console.log(res,'pass')
					this.info = res.data
				})
			},

			back() {
				uni.navigateBack()
			},
			prompt() {
				console.log('prompt')
			},
			//提现
			withdrawal() {
				if(this.info.produceValidIncome==0){
					uni.showToast({
						title:'不可提现金额',
						icon:'none'
					})
					return
				}
				uni.navigateTo({
					url: '/pages/mine/views/yield/cash?type=' + 2 +'&isBack1='+true
				})
			},
			//提现记录
			record() {
				uni.navigateTo({
					url: '/pages/mine/views/yield/record?type=' + 2
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 100%;
		background: #F8FCFF;

		.bg {
			width: 100%;
			height: 696rpx;
			background: url('https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/mine/create/_bg.png') no-repeat;
			background-size: cover;

			.bg_title {
				padding: 76rpx 30rpx 0 32rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;

				&>text {
					font-size: 32rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #000000;
				}
			}
		}

		.contents {
			position: fixed;
			left: 30rpx;
			right: 30rpx;
			top: 160rpx;
			bottom: 222rpx;

			.firstBox {
				display: flex;
				justify-content: space-between;

				.item {
					width: 316rpx;
					height: 296rpx;
					background: #FFFFFF;
					box-shadow: 0px 2px 5px 0px rgba(255, 255, 255, 0.3000);
					border-radius: 20rpx;
					background: #fff;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: space-between;
					position: relative;
					font-size: 50rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #FFA025;
					padding: 60rpx 0 34rpx 0;

					&>image {
						width: 126rpx;
						height: 126rpx;
						position: absolute;
						right: 0;
						bottom: 0;
						z-index: 9;
					}

					.btnBox {
						width: 200rpx;
						height: 60rpx;
						background: #369CFE;
						border-radius: 30rpx;
						line-height: 60rpx;
						text-align: center;
						font-size: 28rpx;
						font-weight: 500;
						color: #FFFFFF;
					}

					&>text {
						font-size: 28rpx;
						font-weight: 500;
						color: #1A1A1A;
					}
				}
			}

			.secondBox {
				// height: 148px;
				background: #FFFFFF;
				box-shadow: 0px 2px 10px 0px rgba(226, 230, 234, 0.3000);
				border-radius: 20rpx;
				margin: 28rpx 0 26rpx 0;
				// padding: 0 32rpx;
				padding: 32rpx;

				&>text {
					font-size: 16px;
					font-family: PingFang SC;
					font-weight: bold;
					color: #1A1A1A;
					margin-top: 32rpx;
				}

				.item {
					display: flex;
					justify-content: space-between;
					align-items: center;
					font-size: 30rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #FFA025;

					.box1 {
						display: flex;
						align-items: center;
						font-size: 28rpx;
						font-weight: 500;
						color: #1A1A1A;

						&>image {
							width: 58rpx;
							height: 58rpx;
							margin-right: 18rpx;
						}
					}
				}

				.border_bottom {
					padding: 38rpx 0 22rpx 0;
					border-bottom: 2rpx solid #EEEEEE;
				}

				.item2 {
					margin-top: 24rpx;
				}

			}

			.thirdBox {
				background: #FFFFFF;
				box-shadow: 0px 2px 10px 0px rgba(226, 230, 234, 0.3000);
				border-radius: 20rpx;

				.item {
					width: 92%;
					margin: 0 auto;
					display: flex;
					align-items: center;
					justify-content: space-between;
					height: 152rpx;

					.left {
						font-size: 26rpx;
						font-family: PingFang SC;
						color: #999999;

						&>text {
							font-size: 30rpx;
							font-weight: bold;
							color: #1A1A1A;
						}
					}

					&>image {
						width: 18rpx;
						height: 34rpx;
					}
				}

				.border_bottom {
					// padding: 0 32rpx;
					border-bottom: 2rpx solid #EEEEEE;
				}
			}
		}
	}
</style>
